package de.mmis.utilities.genericPublisher;

import de.mmis.core.base.infrastructure.PublishedDeviceDescription;
import de.mmis.core.tuplespace.TuplespacePublisher;

public class TuplespacePublishHandle extends PublishHandle {

	final private String host;
	final int port;

	final private TuplespacePublisher publisher;

	public TuplespacePublishHandle(String id, PublishedDeviceDescription descr,
			String host, int port, TuplespacePublisher publisher) {
		super(id, descr);
		this.host = host;
		this.port = port;
		this.publisher = publisher;
	}

	@Override
	public String toString() {
		return "tuplespace " + host + ":" + port;
	}

	@Override
	protected String prettyStringImpl() {
		String result;

		result = "on Tuplespace\n";
		result += "\tHost: " + host + "\n";
		result += "\tPort: " + port + "\n";

		return result;
	}

	/**
	 * @return the host
	 */
	public String getHost() {
		return host;
	}

	/**
	 * @return the port
	 */
	public int getPort() {
		return port;
	}

	/**
	 * @return the publisher
	 */
	TuplespacePublisher getPublisher() {
		return publisher;
	}

}
